package com.foreknow.mapping;


import com.foreknow.model.Admin;

import java.util.HashMap;
import java.util.Map;

public class MappingFactory {
    private static MappingFactory mappingFactory = null;
    private Map<String,EntityMapping> maps = new HashMap<>();
    public static final String ADMIN_MAPPING = "adminMapping";
    public static final String GUESTBOOK_MAPPING = "guestbookMapping";
    public static final String CART_MAPPING = "cartMapping";
    public static final String FOOD_MAPPING = "foodMapping";
    public static final String BUSINESS_MAPPING = "businessMapping";

    private MappingFactory(){
    }

    public static MappingFactory getInstance() {
        if (mappingFactory == null) {
            mappingFactory = new MappingFactory();
            mappingFactory.maps.put(ADMIN_MAPPING,new AdminMapping());
            mappingFactory.maps.put(GUESTBOOK_MAPPING,new GuestbookMapping());
            mappingFactory.maps.put(CART_MAPPING,new CartMapping());
            mappingFactory.maps.put(FOOD_MAPPING,new FoodMapping());
            mappingFactory.maps.put(BUSINESS_MAPPING,new BusinessMapping());
        }
        return mappingFactory;
    }

    public EntityMapping getMapping(String key) {
        return maps.get(key);
    }

}
